Amiga SPectrum emulator ======================= V0.74 ===== (c) Ian Greenway 1999,2000 Introduction: ------------- This is a Sinclair ZX Spectrum 128K emulator for Amiga computers. It is aimed mainly at those emulation enthusiasts who enjoy old games or demos for nostalgic reasons. It is system compliant and multitasks. ASp is a very easy program to use, but there are a couple of points to be aware of. Please read at least the "Requirements" section of this ReadMe. If you have problems, you may find something in the "General Info" section. If you are still stuck, email me and I'll try to help. Features: --------- - 100% system-compliant. - Multitasks in all modes. - Font sensitive Gadtools GUI. - Small, easy to use, authentic emulation of a 48K/128K Sinclair Spectrum. - Comprehensive speed-regulated Z80 CPU emulation core which includes all undocumented instructions and most undocumented flag behaviour. - Genuine Spectrum-like display with support for BRIGHT and clean FLASH. - Stabilised stereo sound (48K and AY-3-8912) synched to CPU T-states. - Direct Kempston joystick support via normal Amiga gameport. See http://www.greew.freeserve.co.uk/ for latest info and updates. New For This Version: --------------------- Much faster 128K bank switching. Z80 loader will now accept SLT files (but still wont load the levels). Reintroduction and enhancement of 68030 speedup mods from V0.71b. F-key for Reload changed to F6, to prevent "accidents". >:-& Fixed menu problems. See Version History for all mods. Requirements: ------------- As an absolute minimum you need a 68020 and WB3.0 (V39). Native chipset, OCS/ECS/AGA, is required. Gfx cards not supported yet. About 800Kb fast ram, 100Kb chip ram. *IMPORTANT:* You absolutely NEED V41 or above of mmu.library by Thomas Richter, for which you will require a working MMU. NOTE! :- mmu.library V42 (when released) is recommended for extra speed. See General Info section. You also need the Spectrum128K ROM Image File (32Kb in size). If it was not in this archive, you can download it from various places on the internet, including the ASp support page. (See below). To get any sort of realistic performance you will need at least a very fast 68030. A 50MHz 68030 runs BASIC at about 85% the speed of a real Spectrum. This is adequate for simple games like Manic Miner, JSW, etc. Faster machines will automatically regulate their speed so they run the same speed as a real Spectrum. Any spare CPU time is available for other tasks in the Amiga system. Installation: ------------- Just copy ASp and the ROM file to any directory you want. You can run ASp from the Shell or the Workbench. You do not need to install the entire of Thomas Richter's MuTools for ASp to work. It is sufficient to simply put "mmu.library" in LIBS:. It is well worth looking at the rest of the package though, as it is extremely comprehensive. How To Use: ----------- If no GUI appears, there has been some serious initialisation error. Check you have enough RAM and all system libraries installed. Note you need a full WB3.0+ (V39+) system. The GUI contains various (hopefully) self-explanatory gadgets and equivalent menu items: RUN / STOP / RESET: These start or stop the emulation. Reset will perform a power-on reset of the virtual Spectrum. LOAD / RELOAD / SAVE: These allow you to load or save the status of the emulation with "snapshot" files. Supported formats are .Z80 (loads all versions, saves V2+ type) and .SNA (also called Mirage, suitable only for 48K mode). ReLoad will instantly reset the emulation to the state it was after the last successful Load, without having to display the filerequester. INSERT / EJECT / REWIND: You can insert or eject a .TAP (tape) file in your virtual tape-deck. This is accessed when the Spectrum tries to LOAD from tape. Rewind will set the tape to its beginning without having to reselect it in a filerequester. Settings Menu: You can select some options which affect the behaviour of the emulation: Hardware: -Reset to 128K mode: When you use the Reset function, this controls if the Spectrum will initialise as a 128K or 48K model. This setting has no effect until you Reset. Loading snapshots of a different mode will override this setting. -AY chip in 48K mode: A normal 48K Spectrum does not have an AY sound chip. If you deselect this option, ASp will intelligently decide if the program or snapshot is in 48K mode and behave as if the chip were not present. Display Type: -AGA Custom CList: Select the faster, but less system-friendly AGA-only display. You cannot perform normal Amiga screen operations, but multitasking is maintained. -OCS System Screen: Select the slower 16-colour system screen option. You can drag and flip this display as with any other Amiga system screen. Sound: -Mono: ASp will only try to allocate one audio channel and mix all sounds into it. -Stereo ABC: ASp will try to allocate two audio chanels as a stereo pair. Any AY-chip sounds will be played as Left, Middle, Right for the A, B and C channels repsectively. 48K sound is played as middle. -Stereo ACB: As Stereo ABC, except channel C is played as middle and channel B is Right. You can use any of the Amiga-key menu shortcuts as well as the menu items themselves. In addition, the following keys are provided: F1 - Load F3 - Save F6 - ReLoad F10 - Reset Esc - Stop All the letter and number keys correspond to the equivalent key positions on a Spectrum. Cursors, backspace and several symbol keys are functional as shortcuts. The Alt keys represent Symbol Shift. All other combinations operate as a normal Spectrum. Eg: Shift-1 is EDIT, Shift-2 is CAPS, etc. Note, A1200 and some PC-adapter keyboards do not work well with multiple simultaneous keypresses. This is a limitation of the keyboard controller, not of ASp. Genral Info: ------------ The following information provides some details and extra information about the features of ASp. You do not need to read this to successfully use ASp, but there may be something here if you run into a problem. MMU.library: The MuTools archive and the mmu.library are by Thomas Richter. ASp only requires the "mmu.library" to be copied to your system "LIBS:" directory for it to actually work. For optimum system performance it may be necessary to perform a more thorough install of this comprehensive package. ASp requires at least V41 of mmu.library. There are new features in V42 which will further improve ASp's 128K paging performance, so you are reccommended to install it as soon as it is released. About the 128K Operation: The 128K memory paging is done via Thomas Richter's mmu.library. This should mean that ASp will work on any system 68020-68060 which has a fully working MMU. It does however, mean that systems without an MMU can no longer run ASp. Hopefully, a future version will drop back to 48K mode if no MMU is available, but for now, this one will not run. Use ASp V0.71b for a 48K-only emulation. If a program attempts to change the memory paging very often (several thousand times per second) ASp may slow down below "real" speed. As of V0.74 the paging speed has been improved by a factor of five with V41 of mmu.library. If you use V42 mmu.library, it is three times better again. ie: Fifteen times faster than previous ASp releases. (Figures relate to a 68060 CPU). The memory model of a 128K machine is such that it can be made to behave like a 48K machine. You can force this by loading a snapshot which was saved in 48K mode, selecting "48 BASIC" from the 128K Spectrum main menu, or by deselecting ASp's "Reset to 128K mode" menu option and Resetting the emulation. Any program running can also voluntarily switch itself into 48K mode, but can never switch back. ASp will detect any of these cases and use this to save its snapshots in 48K mode or switch off AY sound if required. The 128K Spectrum has a "shadow screen". This is emulated, but is not yet synchronised with display updates. Any programs switching between shadow and normal screens very rapidly may get flickering or glitching graphics. This is harmless, but can look untidy. The "Reset to 128K mode" menu item does nothing except determine the type of machine which will be emulated on the next Reset. Changing this setting will have no effect on the running program or the files loaded or saved. In most cases you would leave this ON, unless you really needed to reset regularly to 48K mode. Regardless of the mode of operation the CPU timings are those of a 48K Spectrum (69888 T-states per frame). This will affect almost nothing, but will hopefully be fixed in a future version. File Formats: ASp will load and save Z80 and SNA files. These are the most popular formats found for snapshots. The SNA, or Mirage, format is suitable only for 48K-type information. The Z80 loader will load any Z80 file, but will save Version 2 files in either 48K or 128K mode as appropriate to the current internal status. ASp will try to guess which format you wish to Save by examining your chosen file-extension (".z80" or ".sna") If it can't decide it will ask. When loading files, ASp auto-detects which format to use. In most cases it is advisable to use the Z80 file format as it is both more flexible and produces smaller filesizes. ASp does not directly support externally crunched data files, such as the PowerPacked files that ZXAM produces. You can use some third party transparent file decruncher utility to load such files if you wish. TAP files have only limited support at the moment. Only Loading is allowed, saving will have no effect. The TAP loader patches into the Spectrum's ROM and tries to catch any calls to load information from tape. This means that only programs which use the ROM routines will work with the TAP loader. Note: The SNA format supported here is the 48K one, not the extended 128K one. The TAP files are the type used by Gerton Lunter's Z80, not the Warejevo type. SLT files (extended Z80 files) will be loaded, but the additional level data will not be used. Display Options: The Amiga has some comprehensive display hardware which can be programmed to provide a video display that requires considerably less decode overheads than a conventional display for this application. Unfortunately it is very difficult, if not impossible, to persuade the Amiga OS to provide this level of display hardware flexibility. This means ASp "takes over" the display in this mode. For the purists who don't like the sound of that, there is a 100% system- friendly screen option. It requires up to 8 times longer to update the display so may cause a slowdown under some circumstances especially on slower machines. In most applications however, it is fine. Despite the AGA display being system "unfriendly", it is still entirely system compliant according to the official documentation. Neither multitasking nor interrupts are affected and all the rest of the program continues to operate in the normal system-friendly way. It is not advisable to run programs in the background that need prompt attention, or which themselves may take over the display hardware if you use the AGA Custom option. Neither mode supports border colour stripes. The border colour is updated once per displayed frame only. About the Sound: The basic model of emulation is for a 128K Spectrum. This includes the AY sound chip found in those machines. I believe the emulation of this chip to be the most accurate of any current Amiga emulator. Noise, tones, gating, eneveloping and "4-bit-sample" mode all work correctly. In normal use the 3 AY channels are played as stereo left, centre and right, with the 48K sound mixed in as centre. A real Spectrum has the 48K sound much louder, which may be implemented in a later version. If you are using a program which does not have AY sound you may wish to switch off the "Use AY in 48K mode" menu item. This will substantially reduce the time taken for ASp to build its sound data, but is unlikely to provide an overall speed increase of more than a couple of percent. This is also a way of forcing a program that automatically detects whether to use AY sound to use 48K sound only. In Mono mode all the sound, AY or otherwise, is mixed into one Amiga audio channel. You can still switch off the AY sound as above. Mono mode allows you to run ASp when the number of available audio channels is limited, or if you wish to run more than two copies at once. Mono also provides a very slightly faster sound build than stereo. Again, in real use this is unlikely to be significant. The ASp code directly accesses the sound hardware. This is only done after correctly allocating the channel and interrupts in the system-approved way. This is the only way I can persuade it to work properly, it should cause no problems in a system compliant environment. About running multiple copies of ASp: As of V0.70 it is possible to run as many copies of ASp as you want, limited only by system memory. Every time you ask a copy to RUN the emulation, it will try to allocate audio channel(s). ASp will try to steal the channels even if they are in use by another program, but can still be blocked. So you have a theoretical maximum of four available audio channels allowing a maximum of four emulations running simulataneously (in mono mode). Of course, whether they will all run at top speed or with clean sound is another thing altogether. :-) A fast 68060 will manage about three simultaneously. About the ToolTypes: You can add tooltypes to ASp's icon which will be read on startup. It doesn't matter whether it's started from the WB or CLI. LOADPATH is the directory the Load and Insert file requester will initially open at. Default is nothing, which is the directory from which ASp was run. SAVEPATH is the directory the Save file requester will initially use. Default is "RAM:". ROMFILE is the directory and filename of the ROM file you want to use. This file must be exactly 32768 bytes long. If it isn't a real ROM you will find strange things happen! Defaults to "PROGDIR:Spectrum128.rom". Other Stuff: ------------ This program is Freeware. You may freely redistribute the archive in its entirety, no files may be added, removed or modified. You may not redistribute it for profit. The copyright remains with me, the author. You use this program entirely at your own risk. No responsibility is accepted by the author for damages caused by this program. Contact and Support: -------------------- PLEASE email me with any comments, suggestions or problems you have, at.. iang@ukonline.co.uk There is support available on my website, where you can find the latest version, program information, the rom file, etc.. http://www.greew.freeserve.co.uk/ You may see me around on ArcNET IRC channels as "Laser". Feel free to talk to me about ASp. Thanks for trying ASp! Credits: -------- Various people have been very helpful during the creation of this program. Thanks and acknowledgments to them all: Stephen Brookes Mac Buster Lee Cook David Cripps Martijn van der Heide Thomas Richter Mario Sarno Gerard Sweeney Everyone on the Spectrum Emulator mailing list. ..and a load of other ppl who I've forgotten to mention.. ;-) Information from: A Z80 Workshop Manual - E.A. Parr MC68030 User's Manual - Motorola The "TechInfo.doc" from the "Z80" emulator - Gerton Lunter. The Spectrum Emulator FAQ - Phil Kendall. Various anonymous documents on the internet. And my trusty rubber-keyed Spectrum 48K, of course! --- NewIcon images by Lee Cook. Thanks Lee! The excellent mmu.library and MuTools by Thomas Richter. --- ASp has been written from scratch in 680x0 asm using HiSoft's Devpac 3.18. Some of the data structures have been created in TurboCalc2 and processed using programs I've compiled with VBCC. Total size of source and data files required to build ASp: Appx 790Kb. History: ======== V0.74: Much faster 128K bank switching. Add support for V42 mmu.library. Re-introduce 68030 speedups based on ASp V0.71b. Z80 loader will load the initial part of a SLT. F2 (ReLoad) changed to F6. (Grr!) Better error report on init failure. V0.73dß: Fix: Menus again! Forgot a MENUTOGGLE flag. V0.73cß: Internal development version. V0.73bß: Fix: Fixed NewLook menus rendering as black-on-black. Fix: If AGA wasn't available, the OCS display was broken! V0.73ß: Fix: 128K paging. Fix: Shadow screen swapping. Fix: Glaring major bug in TAP loader. Fix: Z80 loader bugs. Add: Z80 saver. Add: Auto-detect and option for SNA or Z80 save. Add: 48K-128K mode switch. Add: Menus. Add: Stereo sound. Add: About function. Enhance GUI appearance. Speed up sound building. V0.72ß: Prerelease 128K version. Add: 128K paging. Add: 128K file loading. Add: Lots of bugs. ;^) V0.71b: Experimental speedup. 5-15% depending. V0.71: Fix: Rewrote sound handling. No longer uses audio.device calls. Added ToolTypes: LOADPATH, SAVEPATH, ROMFILE. Added Reload and Rewind functions. Key shortcuts for Load, Save, Reload, Reset. System screen now *activates* input! Fixed "." on numeric pad. Test for AGA chipset. Filerequesters are a bit nicer. Inactive GUI buttons are ghosted. Some potential deadlocks removed. V0.70: Speeded up sound routines. Now all audio goes through audio.device! 100% system friendly. Allows running multiple copies at once. :) Add emulation of INI/OUTI/IND/OUTD. Generalised i/o port decoding. V0.69: Internal Test Version. Added AY-3-8912 sound emulation. V0.68: Beta Release only. Limited ".TAP" loading support. V0.67: Now has choice of Custom AGA Display or Native System Screen. GUI: Added STOP button and Display-Type cycle gadget. Can now Load/Save/Reset even if emulator is running. Now requires WB3.0 (V39) or above. Lee Cook contributed an alternative NewIcon. Thanks! V0.65-V0.66: Internal. V0.64: Interim bugfix release: Fixed a nasty enforcer hit in the .SNA loader! Oops! :-) Added facility to load ".Z80" files, versions 1, 2 & 3, 48K type only. V0.63: Added some error requestors. Fiddled around with parts of the source to aid future updates. V0.62B: Made emulation code more regular at minor cost in speed on '030. First public release.